<?php

namespace app\index\model;

use think\Model;

class Project extends Model
{
    public function Pipeline()
    {
        return $this->hasMany('Pipeline', 'proj_id' ,'id');
    }    

    public function Category()
    {
        return $this->hasMany('Category', 'pipeline_id' ,'id');
    }  

    public static function get_proj_pip_cate_data($data='')
    {
        return self::with('Pipeline')->with('Pipeline.Category')->with('Pipeline.Scene')->select();
    }
   
    public static function get_project_id($data=''){
        return self::where(['project_name'=>input('project_name')])->field('id')->find();
    }

    public static function get_data($data='')
    {
        return self::where($data)->select();
    }

    public static function get_count($data='')
    {
        return self::where($data)->count();
    }

    public static function add_data($data)
    {
        return self::insert($data);
    }

    public static function update_data($data)
    {
        return self::update($data);
    }

     public static function delete_data($data='')
    {
        return self::where($data)->delete();
    }
}